<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ page import="com.tisson.pojo.Page"%>
<%@ page import="com.tisson.pojo.Admin"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>

<script type="text/javascript">
function document.onkeydown()                //网页内按下回车触发
{
 if(event.keyCode==13)    //回车键监听
 {
	goto();
 }
}
    
function clearDistrictId(){
	var flag = true;
	if(flag)
	{
		document.getElementById("districtId").value = '';
		document.getElementById("buildingId").value = '';
	}
}
      
function clearBuildingId(){
	var flag = true;
	if(flag)
	{
		document.getElementById("buildingId").value = '';
		document.getElementById("doorId").value = '';
	}
}

function checkAll(name) {
	var el = document.getElementsByTagName('input');
	var len = el.length;
	for(var i=0; i<len; i++){
		if((el[i].type=="checkbox") && (el[i].name==name)){
			el[i].checked = true;
		}
	}
}
function clearAll(name){
	var el = document.getElementsByTagName('input');
	var len = el.length;
	for(var i=0; i<len; i++){
		if((el[i].type=="checkbox") && (el[i].name==name)){
			el[i].checked = false;
		}
	}
} 


</script>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>无标题文档</title>
		<style type="text/css">
img {
	border: 0;
}

<!--
body {
	margin-left: 3px;
	margin-top: 0px;
	margin-right: 3px;
	margin-bottom: 0px;
}

.STYLE1 {
	color: #e1e2e3;
	font-size: 12px;
}

.STYLE6 {
	color: #000000;
	font-size: 12;
}

.STYLE10 {
	color: #000000;
	font-size: 12px;
}

.STYLE19 {
	color: #344b50;
	font-size: 12px;
}

.STYLE21 {
	font-size: 12px;
	color: #3b6375;
}

.STYLE22 {
	font-size: 12px;
	color: #295568;
}
-->
</style>
		<script type="text/javascript" language="javascript">
function home(){
}

function up(){
}

function down(){
}
function checkIsInteger(str)   {    
    if(/^(\-?)(\d+)$/.test(str))   
        return true;   
    else  
        return false;   
}
function lastPage(){
var page = document.getElementById("textfield").value;
document.getElementById()
}
 function add()
 {
   
   var url="/mj/jsp/cm/door/add.jsp?areaId=";
   var districtId = document.getElementById('districtId').value;
   var buildingId = document.getElementById('buildingId').value;
   var areaId = document.getElementById('areaId').value;
   url = url + areaId + "&districtId=" + districtId +"&buildingId=" + buildingId;
   location.href=url;
 }
 function form_submit(){
     var bid = document.getElementById('BuildingId').value;
     var aid = document.getElementById('areaId').value;
     var did = document.getElementById('districtId').value;
	 form.action="Door_delete.action?bid="+bid+"&aid="+aid+"&did="+did;
	 form.submit();
}
 function changePage(para)
 {
   var areaId = document.getElementById('areaId').value;
   var districtId = document.getElementById('districtId').value;
   var buildingId = document.getElementById('buildingId').value;
   var href = para+"&areaId="+areaId+"&districtId="+districtId+"&buildingId="+buildingId;
   window.navigate(href);
   
 }
 function goto(){
	var arg = document.getElementById("page_goto").value;
	if(!checkIsInteger(arg)){
		arg = 1;
	}
	var areaId = document.getElementById('areaId').value;
    var districtId = document.getElementById('districtId').value;
    var buildingId = document.getElementById('buildingId').value;
    var url = "Page_changePage.action?requestPage="+arg+"&map=JspCmDoorList";
    var href = url+"&areaId="+areaId+"&districtId="+districtId+"&buildingId="+buildingId;
    alert(href);
    location.href=href;
}
</script>
	</head>
	<body>
		<form name="searchForm" action="Search_searchList" method="post">
			<input type="hidden" name="userId"
				value="<s:property value="userId"/>" />
			<table width="100%" border="0" align="center" cellpadding="0"
				cellspacing="0">
				<tr>
					<td height="30">
						<table width="100%" border="0" cellspacing="0" cellpadding="0">
							<tr>
								<td height="24" bgcolor="#353c44">
									<table width="100%" border="0" cellspacing="0" cellpadding="0">
										<tr>
											<td>
												<table width="100%" border="0" cellspacing="0"
													cellpadding="0">
													<tr>
														<td width="6%" height="19" valign="bottom">
															<div align="center">
																<img src="<%=basePath%>images/tb.gif" width="14"
																	height="14" />
															</div>
														</td>
														<td width="94%" valign="bottom">
															<span class="STYLE1">搜索</span>
														</td>
													</tr>
												</table>
											</td>
										</tr>
									</table>
								</td>
							</tr>
						</table>
					</td>
				</tr>
				<tr>
					<td>
						<table width="100%" border="0" cellpadding="0" cellspacing="1"
							bgcolor="#a8c7ce">
							<tr>
								<td width="33%" height="20" bgcolor="d3eaef" class="STYLE6">
									<div align="center">
										<span class="STYLE10">区域</span>
									</div>
								</td>
								<td width="33%" height="20" bgcolor="d3eaef" class="STYLE6">
									<div align="center">
										<span class="STYLE10">片区</span>
									</div>
								</td>
								<td width="33%" height="20" bgcolor="d3eaef" class="STYLE6">
									<div align="center">
										<span class="STYLE10">机楼</span>
									</div>
								</td>
							</tr>
							<tr>
								<td height="20" bgcolor="#FFFFFF" class="STYLE19">
									<div align="center">
										<table>
											<s:select name="areaId" onchange="searchForm.submit()"
												id="areaId" list="areaList" listKey="areaId"
												listValue="areaName" cssStyle="STYLE10" cssClass="STYLE10"
												headerValue="请选择区域" headerKey="" onclick='clearDistrictId()' />
										</table>
									</div>
								</td>
								<td height="20" bgcolor="#FFFFFF" class="STYLE19">
									<div align="center">
										<table>
											<s:select name="districtId" onchange="searchForm.submit()"
												id="districtId" list="districtList" listKey="districtId"
												listValue="districtName" headerValue="请选择片区" headerKey=""
												onclick='clearBuildingId()' />
										</table>
									</div>
								</td>
								<td height="20" bgcolor="#FFFFFF" class="STYLE19">
									<div align="center">
										<table>
											<s:select name="buildingId" id="buildingId"
												onchange="searchForm.submit()" list="buildingList"
												listKey="buildingId" listValue="buildingName"
												headerValue="请选择机楼" headerKey="" />
										</table>
									</div>
								</td>
							</tr>
						</table>
					</td>
				</tr>
			</table>
		</form>
		<table width="100%" border="0" align="center" cellpadding="0"
			cellspacing="0">
			<tr>
				<td height="24" bgcolor="#353c44">
					<table width="100%" border="0" cellspacing="0" cellpadding="0"
						height="25">
						<tr>
							<td width="50%" height="25">
								<table width="331" border="0" cellspacing="0" cellpadding="0"
									height="21">
									<tr>
										<td align="center" width="6%" height="19" valign="bottom">
											<img src="<%=basePath%>images/tb.gif" width="14" height="14" />
										</td>
										<td width="94%" valign="bottom">
											<span class="STYLE1"> 门禁基本信息列表</span>
										</td>
									</tr>
								</table>
							</td>
							<td align="right" width="50%">
								<span class="STYLE1"><input type="checkbox"
										name="checkbox" value=""
										onclick="if(this.checked==true) { checkAll('Id'); } else { clearAll('Id'); }">
								</span>
								<span class="STYLE1"> 
								<%if(((Admin)request.getSession().getAttribute("admin")).getRole().equals("中心管理员")){ %>
								全选 &nbsp;&nbsp; <input type="image"
										width="10" height="10" src="<%=basePath%>images/add.gif"
										onClick="add()" /> 添加 &nbsp; <input type="image"
										src="<%=basePath%>images/del.gif" id="_delete"
										name="method:delete" onClick="form_submit()" />
									删除&nbsp;&nbsp;
									<% }%>
									 </span>
								<span class="STYLE1">&nbsp;</span>
							</td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td>
					<table width="100%" border="0" cellpadding="0" cellspacing="1"
						bgcolor="#a8c7ce">
						<tr>
						<% if (((Admin) request.getSession().getAttribute("admin")).getRole().equals("中心管理员")) {
							%>
							<td width="5%" height="20" bgcolor="d3eaef" class="STYLE10">
								<div align="center">
									<input type="checkbox" name="checkbox" value=""
										onclick="if(this.checked==true) { checkAll('Id'); } else { clearAll('Id'); }" />
								</div>
							</td>
							<%} %>
							<td width="16%" height="20" bgcolor="d3eaef" class="STYLE6">
								<div align="center">
									<span class="STYLE10">门禁编码</span>
								</div>
							</td>
							<td width="16%" height="20" bgcolor="d3eaef" class="STYLE6">
								<div align="center">
									<span class="STYLE10">门名</span>
								</div>
							</td>
							<td width="16%" height="20" bgcolor="d3eaef" class="STYLE6">
								<div align="center">
									<span class="STYLE10">门禁地理位置</span>
								</div>
							</td>
							<td width="10%" height="20" bgcolor="d3eaef" class="STYLE6">
								<div align="center">
									<span class="STYLE10">门锁状态</span>
								</div>
							</td>
							<td width="10%" height="20" bgcolor="d3eaef" class="STYLE6">
								<div align="center">
									<span class="STYLE10">告警状态</span>
								</div>
							</td>
							<td width="12%" height="20" bgcolor="d3eaef" class="STYLE6">
								<div align="center">
									<span class="STYLE10">运作状态</span>
								</div>
							</td>
							<td width="16%" height="20" bgcolor="d3eaef" class="STYLE6">
								<div align="center">
									<span class="STYLE10">基本操作</span>
								</div>
							</td>
						</tr>
						<form name="form" action="Door_delete.action" method="post"
							id="form">
							<s:iterator value="result" status="status">
								<tr>
									<%
										if (((Admin) request.getSession().getAttribute("admin"))
													.getRole().equals("中心管理员")) {
									%>
									<td height="20" bgcolor="#FFFFFF">
										<div align="center">
											<input type="checkbox" name="Id" id="Id"
												value="<s:property value="DoorId"/>" />
										</div>
									</td>
									<%
										}
									%>
									<td height="20" bgcolor="#FFFFFF" class="STYLE19">
										<div align="center">
											<s:property value="DoorSerial" />
										</div>
									</td>
									<td height="20" bgcolor="#FFFFFF" class="STYLE19">
										<div align="center">
											<s:property value="DoorName" />
										</div>
									</td>
									<td height="20" bgcolor="#FFFFFF" class="STYLE19">
										<div align="center">
											<s:property value="DoorAddress" />
										</div>
									</td>
									<td height="20" bgcolor="#FFFFFF" class="STYLE19">
										<div align="center">
											<s:property value="DoorSystem" />
										</div>
									</td>
									<td height="20" bgcolor="#FFFFFF" class="STYLE19">
										<div align="center">
											<s:property value="DoorTic" />
										</div>
									</td>
									<td height="20" bgcolor="#FFFFFF" class="STYLE19">
										<div align="center">
											<s:property value="DoorChn" />
										</div>
									</td>
									<td height="20" bgcolor="#FFFFFF">
										<div align="center" class="STYLE21">
											<%
												if (((Admin) request.getSession().getAttribute("admin"))
															.getRole().equals("中心管理员")) {
											%>
											<a
												href="Door_delete.action?Id=<s:property value="DoorId"/>&bid=<s:property value="BuildingId"/>&did=<s:property value="DistrictId"/>&aid=<s:property value="AreaId"/>">删除</a>
											|
											<%
												}
											%>
											<a
												href="Door_edit.action?id=<s:property value="DoorId"/>&buildingId=<s:property value="BuildingId"/>&districtId=<s:property value="DistrictId"/>&areaId=<s:property value="AreaId"/>">编辑</a>
										</div>
									</td>
								</tr>
							</s:iterator>
						</form>
					</table>
				</td>
			</tr>
			<tr>
				<td height="30">
					<table width="100%" border="0" cellspacing="0" cellpadding="0">
						<tr>
							<td width="33%">
								<div align="left">
									<span class="STYLE22">&nbsp;&nbsp;&nbsp;&nbsp;共有<strong><s:property
												value="page.listSize" /> </strong> 条记录，当前第<strong><s:property
												value="page.currentPage" /> </strong> 页，共 <strong><s:property
												value="page.totalPages" /> </strong> 页</span>
								</div>
							</td>
							<td width="67%">
								<table width="312" border="0" align="right" cellpadding="0"
									cellspacing="0">
									<tr>
										<td width="49">
											<div align="center">
												<a
													href="javascript:changePage('Page_changePage.action?requestPage=1&map=JspCmDoorList')"><img
														src="<%=basePath%>images/main_54.gif" width="45"
														height="15" /> </a>
											</div>
										</td>
										<td width="49">
											<div align="center">
												<a
													href="javascript:changePage('Page_changePage.action?requestPage=<s:property value="page.prePage"/>&map=JspCmDoorList')"><img
														src="<%=basePath%>images/main_56.gif" width="45"
														height="15" /> </a>
											</div>
										</td>
										<td width="49">
											<div align="center">
												<a
													href="javascript:changePage('Page_changePage.action?requestPage=<s:property value="page.nextPage"/>&map=JspCmDoorList')"><img
														src="<%=basePath%>images/main_58.gif" width="45"
														height="15" /> </a>
											</div>
										</td>
										<td width="49">
											<div align="center">
												<a
													href="javascript:changePage('Page_changePage.action?requestPage=<s:property value="page.totalPages"/>&map=JspCmDoorList')"><img
														src="<%=basePath%>images/main_60.gif" width="45"
														height="15" /> </a>
											</div>
										</td>
										<td width="37" class="STYLE22">
											<div align="center">
												转到
											</div>
										</td>
										<td width="22">
											<div align="center">
												<input type="text" name="textfield" id="page_goto"
													style="width: 20px; height: 15px; font-size:12px; border: solid 1px #7aaebd;" />
											</div>
										</td>
										<td width="22" class="STYLE22">
											<div align="center">
												页
											</div>
										</td>
										<td width="35">
											<img src="<%=basePath%>images/main_62.gif" width="26"
												height="15" onClick="goto()" />
										</td>
									</tr>
								</table>
							</td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
	</body>
</html>